<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
<!-- 引入时间多选控件Kalendae -->	
<script th:src="@{/ajax/libs/kalendae/kalendae.standalone.js}"></script>
<!-- 引入时间多选控件Kalendae -->
<link th:href="@{/css/kalendae/kalendae.css}" rel="stylesheet" />
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-hatchetPlan-add" th:object="${increaseLimit}">
			<input id="iD" name="iD" th:field="*{iD}"  type="hidden">
		 	
		 	<div class="form-group">
		 		<table>
		 		<tr height="45">
					<td > <button onclick="backCard()" type="button" class="btn btn-primary">返回卡列表</button></td>
					<td></td>
				</tr>
		 		<tr height="45">
					<td style="font-weight: bold;">银行名称：</td>
					<td><span class="form-control-static" th:text="${increaseLimit.bankName}"></span><br/></td>
				</tr>
				<tr height="45">
					<td style="font-weight: bold;">银行卡号：</td>
					<td><span class="form-control-static" th:text="${increaseLimit.bankAccount}"></span><br/></td>
				</tr>
				<tr height="45">
					<td style="font-weight: bold;">持卡人：</td>
					<td><span class="form-control-static" th:text="${increaseLimit.bankAccountName}"></span><br/></td>
				</tr>
				<tr height="45">
					<td style="font-weight: bold;">账单日：</td>
					<td><span class="form-control-static" th:text="${increaseLimit.billDay}"></span><br/></td>
				</tr>
		 		<tr height="45">
					<td style="font-weight: bold;">还款日：</td>
					<td><span class="form-control-static" th:text="${increaseLimit.repaymentDay}"></span><br/></td>
				</tr>
				<tr height="45" id="updatePlanTr">
					<td style="font-weight: bold;">制定计划信息：</td>
					<td><button id="openInput" onclick="openPlanInput()" type="button" class="btn btn-primary">修改信息</button>
					</td>
				</tr>
				<tr height="45" class="inputTr">
					<td style="font-weight: bold;">还款金额：</td>
					<td><input id="planAmt" name="planAmt" class="form-control" type="text"><br/></td>
				</tr>
				<tr height="45" class="inputTr">
					<td style="font-weight: bold;">选择日期：</td>
					<td><div id="planTime" ></div><br/></td>
				</tr>
				<tr height="45" class="inputTr">
					<td style="font-weight: bold;">已选日期：</td>
					<td><textarea oninput="myFunction()" readonly id="showTime" style="color: red;border:none;width:100%;overflow-x:visible;overflow-y:visible;resize:none;"/></textarea><br/></td>
				</tr>
				
				<tr height="45" class="inputTr">
					<td style="font-weight: bold;">还款次数：</td>
					<td><select id="everyNum" name="everyNum"  class="form-control m-b">
							<option value="1">1次/日</option>
							<option value="2">2次/日</option>
							<option value="3">3次/日</option>
						</select><br/></td>
				</tr>
				<tr height="45" class="inputTr">
					<td style="font-weight: bold;">选择城市：</td>
					<td>
						<select class="form-control m-b"  id="provinceSelect">
							<option value="">请选择</option>
						</select>
						<!-- <input class="form-control" placeholder="请输入省份名称"  type= "text" id="provinceId"  value=""/>
				    	<input type="hidden" id="provinceIdList" name="provinceId"> -->
				    	<select class="form-control m-b"  id="cityId" name="cityId" ><option value="">请选择</option></select>
						<br/>
					</td>
				</tr>
				<tr height="45" class="inputTr">
					<td style="font-weight: bold;">选择通道：</td>
					<td><!-- <a onclick="viewAcq()" id="viewAcq">点击选择通道 </a> -->
					<table id="acqTable">
							
					</table><br/></td>
				</tr>
				<tr height="45" id="freeDetail">
					<td style="font-weight: bold;">费用明细：</td>
					<td>
						<button onclick="viewDetail()" id="viewBtn" type="button" class="btn btn-primary">点击计算金额 </button>
					</td>
				</tr>
				<tr>	
					<td colspan="2"><div id="planDiv" style="display: none;">
						<table id="amtTable" >
							<tr>
								<td style="font-size: 18px">项目</td>
								<td style="width: 25px;"></td>
								<td style="font-size: 18px">还款金额(元)</td>
							</tr>
							<tr height="15"></tr>
							<tr>
								<td style="font-size: 18px">周转金金额</td>
								<td style="width: 25px;"></td>
								<td class="revolveAmt" style="font-size: 18px;font-weight: bolder;color: #34C9EF"></td>
							</tr>
							<tr >
								<td style="color: red" colspan="2">
									注：计划完成后会退还<span id="firstPayAmt"></span>元到信用卡
								</td>
							</tr>
							<tr height="15"></tr>
							<tr>
								<td style="font-size: 18px">还款手续费</td>
								<td style="width: 25px;"></td>
								<td id="repaymentFee" style="font-size: 18px;font-weight: bolder;color: #34C9EF"></td>
							</tr>
							<tr>
								<td style="color: red" colspan="2">
									注：还款金额x<span id ="currentRate"></span>
								</td>
							</tr>
							<tr height="15"></tr>
							<tr>
								<td style="font-size: 18px">还款笔数费</td>
								<td style="width: 25px;"></td>
								<td id="repayCountFee" style="font-size: 18px;font-weight: bolder;color: #34C9EF"></td>
							</tr>
							<tr>
								<td style="color: red" colspan="3">
									注：还款笔数费 1元/笔
								</td>
							</tr>
							<tr height="15"></tr>
							<tr>
								<td style="font-size: 18px">周转金手续费</td>
								<td style="width: 25px;"></td>
								<td id="rateRepaymentFee" style="font-size: 18px;font-weight: bolder;color: #34C9EF"></td>
							</tr>
							<tr>
								<td style="color: red" colspan="2">
									注：交易过程中手续费本身产出的手续费
								</td>
							</tr>
							<tr height="15"></tr>
							<tr>
								<td style="font-size: 18px">手续费总金额</td>
								<td style="width: 25px;"></td>
								<td id="sumFee" style="font-size: 18px;font-weight: bolder;color: #34C9EF"></td>
							</tr>
							<tr>
								<td style="color: red" colspan="3">请确保卡内余额大于<span class="revolveAmt" ></span>元,以免计划失败
								</td>
							</tr>
							<tr height="35">
								<td  colspan="3">
									<a onclick="viewPlanItem()" id="btnViewPlanItem">查看计划详情</a>
								</td>
							</tr>
							<tr></tr>
						</table>
						<br>
						<table id="planTable">
							
						</table>
						<br>
						<a class="btn btn-primary  btn-bg" id="submitPlan" onclick="submitPlan()">&nbsp;提交计划</a>
					</div></td>
				</tr>
				<tr></tr>
				
			</table>
			</div>
			<div class="form-group" >
			
			</div>
		</form>
	</div>
	 <div id="dialog" class="modal fade text-center">
		  <div class="modal-dialog" style="display: inline-block; width: auto;">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		        <h4 class="modal-title">开通通道</h4>
		      </div>
		      <div class="modal-body">
		       	验证码 :<input id="smscode" placeholder="请输入用户收到的验证码">
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
		        <button onclick="submitBind()" type="button" class="btn btn-primary">提交</button>
		      </div>
		    </div>
		  </div>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/hatchetPlanForDLS";
		var times ="";//时间集合字符串
		var timeArray = new Array();//日期数组
		var items;
		var plan;
		var limitId; 
		//时间多选控件 Kalendae
		  /*使用方式：
	    new Kalendae(指定容器,配置);
	    配置属性注解：
	    months属性表示日历显示几个月，值：1、2、3.....；默认值：1
	    mode属性表示显示的是单选还是多选还是范围，值：'single'、'multiple'、'range'；默认值：'single'
	    subscribe属性表示绑定kalendea指定的事件，支持的事件有change、date-clicked、view-changed
	    */
	    new Kalendae(document.getElementById("planTime"), {
	            months:1,
	            mode:'multiple',
	            direction: 'future',
	            subscribe: {
	                   'change': function (date) {
	                	   times =  (date._i,this.getSelected());
	                       timeArray =times.split(",");
	                       var newTimsStr = "";
	                       $.each(timeArray,function(index,value){
	                    	  if(value.trim().substring(5,7)>9){
	                    		  newTimsStr += value.trim().substr(5)+", ";
	                    	  } else {
	                    		  newTimsStr += value.trim().substr(6)+", "; 
	                    	  }
	                    	});
	                       $("#showTime").val(newTimsStr.substr(0,newTimsStr.length-2));
	                       viewAcq();
	                   }
	               }
	        });
		var provinceList = [];
	 	
	    
		$("#form-hatchetPlan-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		//初始化方法
	    $(function(){
			getProvince();
			$("#provinceSelect").change(function(){
				//获得选中的值
				var provinceId =  $('#provinceSelect option:selected') .val();//选中的值
				//加载城市列表下拉框
				getCityByProvinceId(provinceId);
			})
			//隐藏(修改信息按钮)
			$("#updatePlanTr").hide();
			
			/* 	$("#provinceId").autocomplete({
					source: getProvince(),
					select:function(event, ui) {
						$("#provinceIdList").val(ui.item.id)
						var provinceId = $("#provinceIdList").val();
						$("#provinceId").val(ui.item.value);
						$("#provinceIdList").val(ui.item.id);
						getCityByProvinceId(provinceId);
					}
				}); */
				$("#planDiv").hide();//初始化隐藏 计划详情信息
				
			});
		
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-hatchetPlan-add').serialize());
	        }
	    }
		var reg = /^[1-9]\d*$/;
		//显示通道
		function viewAcq(){
			var planAmt =  $("#planAmt").val();
			limitId= $("#iD").val();
			 if(planAmt.trim()!=""){
				 if (!reg.test(planAmt)){
		      	  		$.modal.alertError("您的还款金额输入格式不正确,请输入正整数");
		           		$("#planAmt").val("");
		                return ;
		            } 
			 }
			
		  //判断日期必须大于两天
			/* if(timeArray.length<2){
				$.modal.alertError("您选择的还款日期不得少于两天");
				 return ;
			}  */
	    	 var divD = document.getElementById("viewAcq");
	    	        $.ajax({
	    				url : prefix+"/getAcq",
	    				type : "POST",
	    				data : {
	    					"limitId" : limitId,
	    					"planAmt":$("#planAmt").val(),
	    					"everyNum":$("#everyNum").val(),
	    					"times":times
	    					
	    				},
	    				success : function(result) {
	    					if(result.status=="FAIL"){
	    						$.modal.alertError(result.msg);
	    						return;
	    					}else {
	    						var acqList = result.acqList;
	    						var str ="<tr>";
	    						str +="<td><b>通道名称</b></td>";
	    						if(!isPhone()){
	    							str +="<td style='width:50px'></td>";
	    						}else{
	    							str +="<td style='width:1%'></td>";
	    						}
	    						/* str +="<td>开通方式</td>";
	    						if(!isPhone()){
	    							str +="<td style='width:50px'></td>";
	    						}else{
	    							str +="<td></td>";
	    						} */
	    						str +="<td><b>状态</b></td>";
	    						if(!isPhone()){
	    							str +="<td style='width:50px'></td>";
	    						}else{
	    							str +="<td style='width:1%'></td>";
	    						}
	    						str +="<td><b>操作</b></td>";
	    						str +="</tr>";
	    						$.each(acqList, function(i, v) {
	    							str +="<tr>";
	    							str +="<td>";
	    							var acqName = v.acqName;
	    							if(acqName.length>5){
	    								acqName = acqName.substr(0,5)+"...";
	    							}
	    							str +="<label><input name='acq' type='radio' value='"+v.acqCode+v.feeStatus+"' />"+acqName+" </label> ";
	    							str +="</td>";
	    							if(!isPhone){
	    								str +="<td style='width:50px'></td>";
	    							} else {
	    								str +="<td></td>";
	    							}
	    							
	    							/* str +="<td>";
	    							if(v.rspcdResign=="sms"){
	    								str +="短信开通"
	    							} else if (v.rspcdResign=="url"){
	    								str +="收银台开通"
	    							}
	    							str +="</td>"; 
    								str +="<td></td>";*/
	    							
	    							str +="<td>";
	    							if(v.feeStatus=="N"){
	    								str +="未开通";
	    							} else {
	    								str +="已开通";
	    							}
	    							str +="</td>";
    								str +="<td></td>";
	    							str +="<td>";
	    							if(v.feeStatus=="N"){
	    								var openType = v.rspcdResign;
	    								var acqCode = v.acqCode;
	    								str +='<a href="javascript:void(0)" style="text-decoration: none;" onclick=openAcq("'+openType+'","'+acqCode+'")>开通</a>';
	    							} 
	    							str +="</td>";
	    							str +="</tr>";
	    						});
	    						str +="<tr></tr>";
	    						$("#acqTable").html(str);
	    					}
	    				}
	    			});	
	    	}
		
		function openPlanInput(){//点击修改信息按钮
			$("#planDiv").hide();
			$(".inputTr").show();
			//隐藏(修改信息按钮)
			$("#updatePlanTr").hide();
			$('#viewBtn').text("点击计算金额");
			//隐藏费用明细按钮
			$("#freeDetail").show();
		}
		//显示费用明细
		function viewDetail(){
			//判断日期必须大于两天
			 if(timeArray.length<2){
				$.modal.alertError("您选择的还款日期不得少于两天");
				 return ;
			 }  
			 var acqCode = $("input[name='acq']:checked").val();
			 if(acqCode=="" || acqCode==undefined){
 	        	$.modal.alertError("请选择通道");
 	        	return ;
 	        }
			 if(acqCode.substr(acqCode.length-1,acqCode.length)=="N"){
				 $.modal.alertError("该信用卡并没有开通您所选的通道，请开通该通道或者更换已开通的通道");
 	        	 return ;
			 }
			 acqCode = acqCode.substr(0,acqCode.length-1);
	    	 var divD = document.getElementById("planDiv");
    	     if(divD.style.display=="none"){
	    	        var limitId = $("#iD").val();//信用卡id
	    	        //查看费用信息
	    	       //预览计划
	    	        var options=$("#cityId option:selected");
	    	        if(options.text()=="请选择"){
	    	        	$.modal.alertError("请选择城市");
	    	        	return ;
	    	        };
	    	        //xx省-xx市
	    	        var city = $("#provinceSelect option:selected").text()+"-"+options.text();
	    	        var limitId = $("#iD").val();//信用卡id
	    	        var planAmt =  $("#planAmt").val();
	   			    if (!reg.test(planAmt)){
	   	      	  		$.modal.alertError("您的还款金额输入格式不正确,请输入正整数");
	   	           		$("#planAmt").val("");
	   	                return ;
	   	            }
	    	        $.ajax({
	    				url : prefix+"/viewPlanItem",
	    				type : "POST",
	    				data : {
	    					"city" : city,
	    					"limitId" : limitId,
	    					"planAmt":$("#planAmt").val(),//计划金额
	    					"everyNum":$("#everyNum").val(),//每天执行次数
	    					"times":times,//时间字符串
	    					"acqCode":acqCode//通道码
	    				},
	    				success : function(re) {
	    					plan = re;
	    					if(re.status=="FAIL") {
	    						$.modal.alertError(re.msg);
	    						return;
	    					}
    				    if(re.status=="SUCCESS"){
    				    	//显示(修改信息按钮)
    						$("#updatePlanTr").show();
    						//隐藏费用明细按钮
	    					$("#freeDetail").hide();
    				    	//隐藏输入框
	    					$(".inputTr").hide();
    				    	$("#openInput").show();//显示 修改信息 按钮
   						 	$("#currentRate").text(re.rate);//费率
   						 	$(".revolveAmt").text(re.total_zhj);//周转金额
   						 	$("#firstPayAmt").text((re.total_zhj-re.toalFree).toFixed(2));//第一笔退还到信用卡的费用
   						 	$("#repaymentFee").text(re.rate_money);//还款手续费
   						 	$("#repayCountFee").text(re.times_money);//笔数费
   						 	$("#sumFee").text(re.toalFree);//手续费总和 
   						 	$("#rateRepaymentFee").text(re.free_free);   //周转金手续费
   						 	items = re.items;
   							$("#btnViewPlanItem").text("查看计划详情");
   							$("#planTable").html("");
    						divD.style.display = "block";
			    	        $('#viewBtn').text("隐藏金额明细");
    					} 
    				}
    			});	
    	    }  else {
    	        divD.style.display = "none";
    	        $('#viewBtn').text("点击计算金额");
    	    }
    	}
		//提交计划
		function submitPlan(){
			var planStr = JSON.stringify(plan);
			$.modal.confirm("您制定的计划是否准确无误?", function() {
				$.ajax({
					url: prefix+"/submitPlan",
					type:"POST",
					data : {
						"plan":planStr
					},
					success: function(result) {
						if(result.status=="SUCCESS"){
							$.modal.msgSuccess(result.msg);
							$("#submitPlan").hide();
							//隐藏(修改信息按钮)
							$("#updatePlanTr").hide();
							//隐藏费用明细按钮
							$("#freeDetail").hide();
						}else {
							$.modal.alertError(result.msg);
						}
					}
				});
        	})
		}
		
		//初始化省的下拉框
		function getProvince() {
			var array=[];
			$.ajax({
				url: ctx + "system/hatchetAgent/getAllProvince",
				async:false,
				type:"POST",
				data:{},
				success: function(result) {
					var str ="";
					$.each(result, function(i,v) {
						if (v.divisionName != null && v.divisionName != undefined) {
							str += "<option value="+ v.id+">"+v.divisionName+"</option>";
						}
					});
					$("#provinceSelect").append(str);
				}
			});
			return array;
		}

		// 获取某个省下的市列表
		function getCityByProvinceId(provinceId) {
			$("#cityId").empty();
			var _default = "<option id='' value=''>请选择</option>";
			var optionStatus=_default;
			var cityOrarea = $("#provinceIdList").val();
			$.ajax({
				url : ctx + 'system/hatchetAgent/getHatchetAdministrativeDivisionsByChinaAreaId',
				async : false,
				type : "POST",
				data : {
					"parentId" : provinceId
				},
				success : function(result) {
					$.each(result, function(k, v) {
						if ('' != provinceId) {
							optionStatus=optionStatus+"<option id='"+v.id+"'  value='"+v.id+"'>"+v.divisionName+"</option>";
						}
					});
				}
			});	
			$("#cityId").append(optionStatus);
		};
		
		//提交申请所需参数
		var acqcode;
		var smsseq;
		var bindid;
		var dsorderid;
		var bindid;
		//申请开通通道(预绑卡)
		function openAcq(openType,acqCode){
			acqcode = acqCode;
			$.modal.confirm("您确认要申请开通该通道吗？您必须和持卡人保持联系畅通,该操作需要持卡人提供短信验证码,并及时输入", function() {
				$.ajax({
					url : prefix+"/openAcq",
					type : "POST",
					data : {
						"limitId" : limitId,
						"acqCode":acqCode
					},
					success : function(result) {
						//错误
						if(result.apistatus=="0"){
							 $.modal.alertError(result.apimsg);
							 return;
						//已绑卡	 
						} else if (result.apistatus=="2"){
							$.modal.alertError(result.apimsg);
							 viewAcq();
							 return;
						}
						if(result.apistatus=="1" && (result.smsseq != null || result.bankId !=null || result.bindurl !=null)){
							//弹出模态框准备输入验证码
							$('#dialog').modal('show');
							//快付通
							if(result.smsseq != null){
								smsseq = result.smsseq;
								dsorderid = result.dsorderid;
							//新生大额	
							} else if(bindid != null){
								bindid = result.bankId;
							//小额A	
							}
						}
					}
				});	
		    })
		}
		
		//提交开通通道申请
		function submitBind(){
			var smscode = $("#smscode").val();
			if(smscode.trim().length != 6){
				 $.modal.alertError("请输入正确的短信验证码");
				 return;
			};
			var postData = {
				"cardid" : limitId,
				"acqcode":acqcode,
				"smsseq":smsseq,
				"smscode":smscode,
				"bindid":bindid,
				"dsorderid":dsorderid
				
			};
			$.ajax({
				url : prefix+"/bindAcq",
				type : "POST", 
			    data :JSON.stringify(postData), 
			    contentType:"application/json",
			    dataType : "json", 
				success : function(result) {
					$('#dialog').modal('hide');
				if(result.apistatus=="0"){
					 $.modal.alertError(result.apimsg);
					 viewAcq();
					 return;
				}else if(result.apistatus=="1"){
					$.modal.msgSuccess(result.apimsg);
					 viewAcq();
				}
			}
		});	
	};
   	//判断当前浏览器是否为手机 
   	function isPhone(){
       	 var sUserAgent = navigator.userAgent.toLowerCase();  
       	 var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";   
       	 var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";       
       	 var bIsMidp = sUserAgent.match(/midp/i) == "midp"; 
       	 var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; 
       	 var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";    
       	 var bIsAndroid = sUserAgent.match(/android/i) == "android";  
       	 var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";  
       	 var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";        
       	 if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) { 
       		 return true;//是手机
     	   } else {  
     		return false; //是pc
     	   }
   	}		
		
		document.getElementById("planAmt").oninput = function() {myFunction()};
		document.getElementById("everyNum").oninput = function() {myFunction()};
				 
		function myFunction() {
		    viewAcq();
		}
		
		function backCard(){
			window.location.href=ctx+'system/hatchetMerchantIncreaseLimitForJLR';
		}
		
		function viewPlanItem(){
			if($("#btnViewPlanItem").text()=="查看计划详情"){
				$("#btnViewPlanItem").text("隐藏计划详情");
				var str ="";
				$.each(items, function(i, v) {
					var type = "";
					if(v.type =="sale"){
						type ="消费";
					} else {
						type ="还款";
					}
					if(i%2==0){
						str += "<tr>"; 
						str += "<td style='width:45px;color:blue'>"; 
						str += type; 
						str += "</td>"; 
						str += "<td>"; 
						str += v.time; 
						str += "</td>"; 
						str += "<td style='width:45px' align='center'>"; 
						str += "金额"; 
						str += "</td>"; 
						str += "<td>";
						str += v.money; 
						str += "</td>";  
						str += "</tr>"; 
						
						str += "<tr>"; 
						str += "<td>"; 
						str += "类型"; 
						str += "</td>"; 
						str += "<td>"; 
						var cityindustryName = v.cityindustryName;
						if(cityindustryName.length>10){
							cityindustryName = cityindustryName.substr(0,10)+"...";
						}
						str += cityindustryName; 
						str += "</td>"; 
						str += "<td style='width:45px' align='center'>"; 
						str += "地点"; 
						str += "</td>"; 
						str += "<td>";
						str += v.customizecity; 
						str += "</td>"; 
						str += "</tr>"; 
					} else  {
						str += "<tr>"; 
						str += "<td style='width:45px;color:green'>"; 
						str += type; 
						str += "</td>"; 
						str += "<td>"; 
						str += v.time; 
						str += "</td>"; 
						str += "<td style='width:45px' align='center'>"; 
						str += "金额"; 
						str += "</td>"; 
						str += "<td>";
						str += v.money; 
						str += "</td>"; 
						str += "</tr>";
						//加上分割线
						if(i != items.length-1){
							str += "<tr>"; 
							str += "<td colspan='4'>";
							str += "<hr>";
							str += "</td>"; 
							str += "</tr>";
						}
					}
					str += "<tr>"; 
					str += "</tr>";
					$("#planTable").html(str);
				});
			} else { 
				$("#btnViewPlanItem").text("查看计划详情");
				$("#planTable").html("");
			}
			
		}
		
	</script>
</body>
</html>
